4 w = SCNSObject("NSWindow", "initWithContentRect:styleMask:backing:defer:", [ Rect(100,600,500,200), 10, 2, 1]);
6 w.invoke("makeKeyAndOrderFront:", [nil], true);
7 w.invoke("setTitle:", [ "Hello, World!" ], true);
10 b = SCNSObject("NSButton", "initWithFrame:", [ Rect(10,10,75,22) ]);
11 b.invoke("setBezelStyle:", [10], true);
13 v = w.invoke("contentView");
14 v.invoke("addSubview:", [ b ], true);
19 // - (void)buttonAction:(id)sender;
20 w.nsDelegate.addMethod("buttonAction:", "v", "@", { arg method, args;
21 var btn = args.at(0).asNSReturn; // args.at(0) is the button
23 btn.invoke("state").postln;
28 b.invoke("setTarget:", [ w.nsDelegate ], false);
29 b.invoke("setAction:", [ "buttonAction:" ], false); // SEL are recognized now
40 w = SCNSObject("NSWindow", "initWithContentRect:styleMask:backing:defer:", [ Rect(100,650,500,40), 10, 2, 1]);
42 w.invoke("makeKeyAndOrderFront:", [nil], true);
43 w.invoke("setTitle:", [ "Hello, World!" ], true);
46 l = SCNSObject("NSSlider", "initWithFrame:", [ Rect(10,10,480,22) ]);
48 v = w.invoke("contentView");
49 v.invoke("addSubview:", [ l ], true);
54 w.nsDelegate.addMethod("sliderAction:", "v", "@", { arg method, args;
55 var slider = args.at(0).asNSReturn;
57 slider.invoke("doubleValue").postln;
62 l.invoke("setTarget:", [ w.nsDelegate ], false);
63 l.invoke("setAction:", [ "sliderAction:" ], false);